<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>房间管理-宿管系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/basicLayout.css">
</head>
<body>

<!--    头部，用来放导航栏-->
<div id="header">
    <ul>
        <li><a href="${pageContext.request.contextPath}/student/index"> 学生管理</a></li>
        <li><a href="${pageContext.request.contextPath}/class/index"> 班级管理</a></li>
        <li><a href="${pageContext.request.contextPath}/room/index"> 房间管理</a></li>
    </ul>
</div>

<!--子导航栏区域-->
<div id="child">
    <label>房间管理功能</label>
    <ul>

        <li><a href="${pageContext.request.contextPath}/room/add/index">添加房间</a></li>
    </ul>
</div>

<!--主体内容区域-->
<div id="content">
    <div id="search">
        <form action="${pageContext.request.contextPath}/room/query" id="searchForm" method="post">
            <table id="searchTable">
                <tr>
                    <td>房间地址：<input type="text" id="roomAddress" name="roomAddress" value=""></td>
                    <td>房间状态：<select name="roomStatus" id="roomStatus">
                        <option value="不限">不限</option>
                        <option value="Y">正常</option>
                        <option value="N">损坏</option>
                    </select>
                    </td>
                </tr>
                <tr>
                    <td>可住房间：
                        <select name="canin" id="canin">
                            <option value="不限">不限</option>
                            <option value="可住房间">可住房间</option>
                        </select>
                    </td>

                    <td>房间类型：
                        <select name="roomType" id="roomType">
                            <option value="不限">不限</option>
                            <option value="F">男生寝室</option>
                            <option value="M">女生寝室</option>
                        </select>
                    </td>

                    <td><input type="submit" value="搜索"></td>
                    <td><input type="reset" value="重置"></td>
                </tr>
            </table>
        </form>
    </div>
    <div id="show">
        <table id="showTable">
            <tr>

                <th>房间地址</th>
                <th>可容纳人数</th>
                <th>已住人数</th>
                <th>房租</th>
                <th>房间状态</th>
                <th>房东</th>
                <th>房东电话</th>
                <th>房间类型</th>
                <th></th>
            </tr>

            <c:forEach items="${allRooms}" var="room">
            <tr>
                <td>${room.roomAddress}</td>
                <td>${room.capNum}</td>
                <td>${room.inNum}</td>
                <td>${room.rentPrice}</td>
                <c:if test="${room.roomStatus=='Y'}">
                    <td>正常</td>
                </c:if>
                <c:if test="${room.roomStatus=='N'}">
                    <td>设备损坏</td>
                </c:if>

                <td>${room.roomHost}</td>
                <td>${room.hostTel}</td>
                <c:if test="${room.roomType=='F'}">
                    <td>男生寝室</td>
                </c:if>
                  <c:if test="${room.roomType=='M'}">
                    <td>女生寝室</td>
                </c:if>
                <td><a href="${pageContext.request.contextPath}/room/info?roomId=${room.roomId}">查看详情</a></td>
                <td><a href="${pageContext.request.contextPath}/room/record/index?roomId=${room.roomId}">查看设施</a></td>
                <td><a href="${pageContext.request.contextPath}/room/delete/execute?roomId=${room.roomId}">删除房间</a></td>
            </tr>
            </c:forEach>
        </table>
    </div>
</div>

<!--页脚内容区域-->
<div id="footer">页脚</div>
</body>
</html>
